<div class="invoice_header">{{invoiceHeader|safe}}</div>
<div class="invoice_body">
	<table>
		<tr>
			<td style="width:40%;">
				<table style="border: 1px solid #000;" cellpadding="5" cellspacing="1">
					<tr><td>{{user_firstName}} {{user_lastName}}</td></tr>
					<tr><td>{{user_street}}</td></tr>
					<tr><td>{{user_zipCode}}, {{user_city}}</td></tr>
					<tr><td>P.I. {{user_vatNumber}}</td></tr>
					<tr><td>IBAN {{user_iban}}</td></tr><!-- IT92 I051 1654 5700 0000 0002 735 -->
				</table>
			</td>
			<td style="width:20%;">&nbsp;</td>
			<td style="width:40%">
				<span style="font-weight:bold;">Cliente</span>
				<table style="border: 1px solid #000;" cellpadding="5" cellspacing="1">
					<tr><td>{{customer_name}}</td></tr>
					<tr><td>{{customer_street}}</td></tr>
					<tr><td>{{customer_zipCode}}, {{customer_city}}</td></tr>
					<tr><td>P.I. {{customer_vatNumber}}</td></tr>
				</table>
			</td>
		</tr>
		<tr><td>&nbsp;</td></tr>
		<tr>
			<td style="width: 20%;">
				<table style="border: 1px solid #000;" cellpadding="5" cellspacing="1">
					<tr>
						<td><span style="font-weight:bold;">Nr. Fattura</span></td>
						<td style="text-align: right;">{{invoiceNumber}}</td>
					</tr>
				</table>
			</td>
			<td style="width:20%;">&nbsp;</td>
			<td style="width: 20%;">
				<table style="border: 1px solid #000;" cellpadding="5" cellspacing="1">
					<tr>
						<td><span style="font-weight:bold;">Data fattura</span></td>
						<td style="text-align: right;">{{date}}</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<table><tr><td>&nbsp;</td></tr></table>
	<table style="border: 1px solid #000;" cellpadding="5" cellspacing="0" class="invoice_lines">
		 <thead>
		 	<tr>
		 		<th class="description">Descrizione</td>
		 		<th class="amount">Importo</td>
		 	</tr>
		 </thead>
		 <tbody>
		 	{% for row in rows %}
			<tr>
			   <td class="description">{{row.description}}</td>
			   <td class="amount">&euro; {{ '{0:0.2f}'.format(row.amount) }}</td>
			</tr>
			{% endfor %}
		 	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
		 </tbody>
		 <tfoot>
		 	<tr>
		 		<th class="description">Imponibile</th>
		 		<th class="amount">&euro; {{ '{0:0.2f}'.format(imponibile) }}</th>
		 	</tr>
		 	{% for add in additionals %}
			<tr>
			   <th class="description">{{add.name}} {{add.label_value}}</th>
			   <!--<th class="amount">{{add.value}}{% if add.type=="percentage" %}% {% else %}&euro; {% endif %} </th>-->
			   <th class="amount">&euro; {{ '{0:0.2f}'.format(add.calc_value) }}</th>
			</tr>
			{% endfor %}


		 	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
		 	<tr>
		 		<th class="description">Totale</th>
		 		<th class="amount">&euro; {{ '{0:0.2f}'.format(totale) }}</th>
		 	</tr>
		 </tfoot>
	</table>
</div>
<div class="invoice_footer">
	Fattura emessa il {{date}} alle ore {{time}} UTC
	<br/>
	{{invoiceFooter|safe}}
</div>

<style type="text/css">
.invoice_header, .invoice_body, .invoice_footer{
	width: 100%;
	padding: 20px 0;
	font-family: sans-serif;
}
.invoice_header, .invoice_footer{
	font-size: 12px;
}
.invoice_body{
	font-size: 13px;
}
.invoice_body table{
	width: 100%;
}

.invoice_lines tr td, .invoice_lines tr th{
	border-left: 1px solid #000;
	border-bottom: 1px solid #000;
}
.invoice_lines tr th{
	text-align: center;
}
.invoice_lines tr td:first-child, .invoice_lines tr th:first-child{
	border-left: none;
}
.invoice_lines tr .description{
	width: 60%;
}
.invoice_lines tr .amount{
	width: 40%;
}
.invoice_lines tbody tr .amount, .invoice_lines tfoot tr .amount{
	text-align: right;
	font-weight: normal;
}
.invoice_lines tfoot tr .description{
	text-align: right;
}
</style>